home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
301-325
/
disk_313
/
uucp
/
uucp1.lzh
/
src
/
lib
/
setstdin.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-01-10
|
815b
|
40 lines
/*
* SETSTDIN.C
*
* (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved.
*
* Sets stdin, stdout, and stderr to UUSER: handler
*/
#include <stdio.h>
SetStdin(ac, av)
char *av[];
{
short i;
short getty = 0; /* from getty */
char *device = "serial.device"; /* device name */
long unit = 0; /* unit no. */
char buf[64];
FILE *f1, *f2, *f3;
for (i = 1; i < ac; ++i) {
char *ptr = av[i];
if (*ptr != '-')
continue;
if (ptr[1] == 'D')
device = av[++i];
if (ptr[1] == 'U')
unit = atoi(av[++i]);
if (ptr[1] == 'G')
getty = 1;
}
sprintf(buf, "UUSER:%s/%d/R1000G%d", device, unit, getty);
f1 = freopen(buf, "r", stdin);
f2 = freopen(buf, "w+", stdout);
f3 = freopen(buf, "w+", stderr);
return(f1 && f2 && f3);
}